//Accepted
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;


int main (){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	int n, a, b, i, sum=0, x=0;
	
	scanf("%d", &n);
	for(i=0;i<n;++i){
		scanf("%d%d", &a, &b);
		sum+=b;
		sum-=a;
		if(sum>x)x=sum;
	}
	printf("%d",x);
	return 0;
}
